package com.qys.livesMall.system.controller.app;

import com.qys.livesMall.common.result.R;
import com.qys.livesMall.framework.view.QysPage;
import com.qys.livesMall.system.modal.dto.ThinkTanksInfoQuery;
import com.qys.livesMall.system.modal.dto.ThinkTanksTypeQuery;
import com.qys.livesMall.system.modal.entity.SysThinkTanksInfo;
import com.qys.livesMall.system.modal.entity.SysThinkTanksType;
import com.qys.livesMall.system.service.SysThinkTanksInfoService;
import com.qys.livesMall.system.service.SysThinkTanksTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * App平台智库类型
 *
 * @author
 * @since 2023-10-31
 */
@RestController
@RequestMapping("/app/thinkTanks")
public class AppThinkTanksTypeController {

    @Autowired
    private SysThinkTanksTypeService thinkTanksTypeService;
    @Autowired
    private SysThinkTanksInfoService thinkTanksInfoService;
    /**
     * 类型查询
     * @param query
     * @return
     */
    @PostMapping("/all")
    public R<List<SysThinkTanksType>> getAll(@RequestBody ThinkTanksTypeQuery query){
        return R.ok(thinkTanksTypeService.getAll(query));
    }

    /**
     * 问题查询
     * @param search
     * @return
     */
    @PostMapping("/search")
    public R<QysPage<SysThinkTanksInfo>> search(@RequestBody ThinkTanksInfoQuery search){
        return R.ok(thinkTanksInfoService.search(search));
    }
}
